package team.kirohuji.utils;

import java.util.Base64;
import java.util.Base64.Decoder;

public class BasicAuthenticationUtils {
	public static String checkHeaderAuth(String auth) {
		auth = auth.substring(6, auth.length());
		return getFromBASE64(auth);
	}
	private static String getFromBASE64(String s) {
		if (s == null)
			return null;
		Decoder decoder = Base64.getDecoder();
		try {
			byte[] b = decoder.decode(s);
			return new String(b);
		} catch (Exception e) {
			return null;
		}
	}
}
